/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     ListNode *next;
 *     ListNode(int x) : val(x), next(NULL) {}
 * };
 */
class Solution {
public:
    vector<int> reversePrint(ListNode* head) {
        stack<int> st;
        vector<int> ret;

        ListNode* cur = head;
        while(cur)
        {
            st
            .push(cur->val);
            cur = cur->next;
        }
        
        int size = st.size();
        for(int i = 0; i < size;++i)
        {
            ret.push_back(st.top());
            st.pop();
        }

        return ret;

    }
};
